home *** CD-ROM | disk | FTP | other *** search
/ Champak 43 / Vol 43.iso / games / menininh.swf / scripts / __Packages / ScoreInterface.as < prev    next >
Encoding:
Text File  |  2007-07-06  |  1.4 KB  |  48 lines

  1. class ScoreInterface
  2. {
  3.    var mVariables;
  4.    var mLoadCallback;
  5.    var SCORE_LOAD_URL = "getScore.asp";
  6.    var SCORE_SAVE_URL_PREFIX = "score.asp";
  7.    function ScoreInterface()
  8.    {
  9.       this.mVariables = new LoadVars();
  10.    }
  11.    function saveScore(name, score, email, state, callback)
  12.    {
  13.       this.mLoadCallback = callback;
  14.       var _loc2_ = "";
  15.       _loc2_ += "score=" + score;
  16.       _loc2_ += "&nick=" + name;
  17.       _loc2_ += "&email=" + email;
  18.       _loc2_ += "&state=" + state;
  19.       trace("ScoreInterface::saveScore: sending [" + _loc2_ + "]");
  20.       var _loc3_ = RC4.encrypt(_loc2_,"U4D$3R3e#");
  21.       this.mVariables = new LoadVars();
  22.       this.mVariables.onLoad = this.onScoresSave;
  23.       this.mVariables.mLoadCallback = callback;
  24.       this.mVariables.mVariables = this.mVariables;
  25.       trace("ScoreInterface::saveScore: encrypted as [" + this.SCORE_SAVE_URL_PREFIX + "?k=" + _loc3_ + "]");
  26.       this.mVariables.load(this.SCORE_SAVE_URL_PREFIX + "?k=" + _loc3_);
  27.    }
  28.    function onScoresSave(success)
  29.    {
  30.       trace("ScoreInterface::onScoresSave: success is [" + success + "]");
  31.       if(success)
  32.       {
  33.          if(this.mVariables.res > 0)
  34.          {
  35.             this.mLoadCallback.onScoreSave();
  36.          }
  37.          else
  38.          {
  39.             this.mLoadCallback.onScoreSaveError();
  40.          }
  41.       }
  42.       else
  43.       {
  44.          this.mLoadCallback.onScoreSaveError();
  45.       }
  46.    }
  47. }
  48.